﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Text;
using ORM_Benchmark.Runner.Interface;

namespace ORM_Benchmark.Runner.EFv41
{
    public class EFv41EntityProductContext : DbContext
    {
        public EFv41EntityProductContext(IConnect connection) : base(connection.ConnectionString)
        {
        }

        public DbSet<EfEntityTypeProduct> Products { get; set; }

        internal void Insert(List<EfEntityTypeProduct> efv41EntityTypeProducts)
        {
            efv41EntityTypeProducts.ForEach(product => Products.Add(product));
            SaveChanges();
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
                modelBuilder.Configurations.Add(new EFv41ProductMapping());
            base.OnModelCreating(modelBuilder);
        }
    }
}
